<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<%@taglib prefix="mvc" uri="http://www.springframework.org/tags/form" %>
<%@taglib prefix="fmt" uri="http://www.springframework.org/tags" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html>
<head >
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <title>工作流办理</title>
    <link rel="stylesheet" href="../../css/workflow/work/m/style.css">
    <script src="../../js/jquery/jquery-1.9.1.js"></script>
    <style>
        
        body{
            font-size: 12px;
            font-family: "Helvetica Neue", Helvetica, Arial, "PingFang SC", "Hiragino Sans GB", "Heiti SC", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif;
        }
        .ui-dialog{
            margin-left: 0px !important;
            margin-top: -40px !important;
        }
        .main2{background: #efefef;margin-top: 0px;}
        .file {
            position: relative;
            display: inline-block;
            background: #007df8;
            border: 1px solid #007df8;
            border-radius: 2px;
            padding: 0px 6px;
            overflow: hidden;
            color: #fff;
            text-decoration: none;
            text-indent: 0;
            line-height: 20px;
        }
        .uploadbox p{margin-bottom: 5px;color: #095de0;}
        .grey{
            color: #333!important;
        }
        .grey1{
            color: #333!important;
        }
        .grey option.selected {
            color: #fff!important;
        }
        table{
            border-collapse: inherit;
        }
        .gapp_input {
            height: 45px;
            margin-left: 0px;
            border-width: 0px;
            width: calc(100% - 10px);
            border: 1px solid #e4e4e4;
            border-radius: 4px;
            text-indent: 10px!important;
            padding-right: 10px!important;
        }
        .type_done{
            border: none;
            border-radius: 8px;
            background-color: #3b87f5;
            padding: 13px 35px;
            font-size: 16px;
            margin-top: 20px;
            margin-left: 15px!important;
            font-weight: bold
        }

        #weituofoot,#list_btn_close{
            margin-left: 0px!important;
        }
        #deleteBtn{
            background-color: #ec5959;
        }
        .done{
            height: auto;
            border-bottom:none;
            /*margin-bottom: 45px;*/
            padding-bottom: 100px;
        }
        .head_toptitle{
            font-size: 14px;
            height: 14px;
            line-height: 14px
        }
        .head_top{
            height: auto;
            border-top: none;
            padding: 0 16px;
        }
        #basic_infor .table{
            padding-left: 16px;
            padding-right: 16px;
            padding-bottom: 20px;
        }
        #basic_infor table{
            table-layout: fixed;
        }
        #basic_infor .table .td1,#weituocontent table .td1{
            position: relative;
            width: 88px;
            border-right: 1px solid #efefef;
        }
        #basic_infor .table .td1 div,#weituocontent table .td1 div{
            min-height: 36px;
            margin: 12px 5px 0 5px;
            line-height: 25px;
            border-right: none;
        }
        #basic_infor .table .td2,#weituocontent table .td2{
            position: relative;
            line-height: 36px;
            padding-left: 10px;
            padding-right: 5px;
            padding-top: 12px;
            padding-bottom: 12px;
        }
        #opflagturn,#formInfo{
            padding: 13px 19px;
        }
        @media screen and (min-width: 321px) and (max-width:360px){
            #lctbtn{
                padding: 13px 24px!important;
            }
            .type_done{
                margin-left: 9px;
                padding: 13px 32px;
            }
            #opflagturn,#formInfo{
                padding: 12px 16px;
            }
        }
        @media screen and (max-width: 320px){
            #lctbtn{
                padding: 13px 19px!important;
            }
            .type_done{
                padding: 12px 26px;
                font-size: 15px;
            }
            #opflagturn,#formInfo{
                padding: 12px 11px;
            }
        }
        @media screen and (min-width: 400px) and (max-width:420px){
            .type_done{
                margin-left: 24px!important;
            }
        }

        .td2 img{
            float: left;
            width: 58px;
            height: 58px;
            margin: 0 5px!important;
        }
        .td2 .qrcode img{
            float: left;
            width: 100%;
            height: 100%;
        }
        .head_top{
            margin-top: 0px;
            padding-top: 14px;
            padding-bottom: 10px;
        }
        .weight{
            font-weight: 300;
        }
        .head_top ul li span{
            letter-spacing: 1px;
        }
        #basic_infor .basic_infor_title{
            background: #f5f5f9;
            height: 32px;
            padding: 0 16px;
        }
        #basic_infor .basic_infor_title .basic_infor{
            margin-left: 6px;
            line-height:32px;
        }
        #basic_infor .basic_infor_title .icon{
            margin-top: 8px;
            height: 16px;
            width: auto;
        }
        #content input,#content textarea,#content select,#weituocontent input,#weituocontent textarea,#weituocontent select{
            border:1px solid #e4e4e4!important;
            font-size: 16px;
            font-family: "Helvetica Neue", Helvetica, Arial, "PingFang SC", "Hiragino Sans GB", "Heiti SC", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif;
            -webkit-appearance: none;
            /*background-color: #fffde9;*/
            background-color: #fff9c1;
        }
        #content input[data-type="checkbox"]{
            -webkit-appearance: checkbox;
            background: #fff!important;
            opacity: 0;
        }
        #content input[data-type="radio"]{
            -webkit-appearance: radio;
            background: #fff!important;
        }
        #content input.grey,#content textarea.grey,#weituocontent input.grey,#weituocontent textarea.grey{
            background: #f8f8f8!important;
        }
        textarea{
            padding: 10px 0;
        }
        input:disabled,textarea:disabled{
            opacity:1;
        }
        .gapp_textarea{
            border: 1px solid #e4e4e4;
            border-radius: 4px;
            padding:10px;
            margin-top: 10px;
            margin-bottom: 0;
            margin-left: 0px;
            line-height: 20px;
            width: calc(100% - 20px)!important;
        }
        .hqbox{
            margin-bottom: 10px;
        }
        input[data-type="calendar"]{
            height:45px!important;
            background: url("/img/workflow/work/workformh5/calendar1.png") no-repeat 95% 12px;
        }
        input[type="radio"],input[type="checkbox"] {
            width: 20px;
            height: 20px;
        }
        label {
            position: absolute;
            left: 9px;
            top: 15px;
            width: 20px;
            height: 20px;
            border-radius: 50%;
            border: 1px solid #e4e4e4;
            background: #fff;
        }

        /*设置选中的input的样式*/
        /* + 是兄弟选择器,获取选中后的label元素*/
        input:checked+label {
            background-color: #fe6d32;
            border: 1px solid #fe6d32;
        }

        input:checked+label::after {
            position: absolute;
            content: "";
            width: 5px;
            height: 10px;
            top: 3px;
            left: 6px;
            border: 2px solid #fff;
            border-top: none;
            border-left: none;
            transform: rotate(45deg)
        }
        .gapp_select{
            width: calc(100% - -2px);
            height: 47px;
            margin-left: 0px;
            border: 1px solid #e4e4e4;
            border-radius: 4px;
            text-indent: 10px;
            background: url("/img/workflow/work/workformh5/selecthei.png") no-repeat 95% 12px;
            padding-right: 40px!important;
        }
        .gapp_textarea{
            height: 130px;
        }
        .textareaclass{

            top: 0;
        }
        .fl{
            float: left;
        }
        .bgweijinyong{
            /*background:#fffde9;*/
            background:#fff9c1;
        }
        .bgyijingyong{
            background:#f8f8f8;
        }
        .uploadbox{
            font-size: 11pt;
        }
        .autospan{
            color: cornflowerblue;
            position: absolute;
            top: 13px;
            right: 4px;
            height: 40px;
            display: inline-block;
            height: 45px;
            line-height: 45px;
            z-index: 1001;
            background: #fff9c1;
            padding: 0 6px;
        }
        .listbox input[type="radio"],input[type="checkbox"] {
            width: 15px;
            height: 15px;
        }
        #signText{
            border: 1px solid #e4e4e4!important;
        }
        #signText.grey{
            background: #f8f8f8!important;
        }

        select, textarea, input[type="text"], input[type="password"], input[type="datetime"], input[type="datetime-local"], input[type="date"], input[type="month"], input[type="time"], input[type="week"], input[type="number"], input[type="email"], input[type="url"], input[type="search"], input[type="tel"], input[type="color"], .uneditable-input {
            display: inline-block;
            padding: 0px;
            //margin-bottom: 10px;
            font-size: 13px;
            line-height: 20px;
            color: #555555;
            -webkit-border-radius: 4px;
            -moz-border-radius: 4px;
            border-radius: 4px;
            vertical-align: middle;
        }
        .headTitle li{
            font-size: 12px;
            line-height: 14px;
        }
        .uploadImg{
            display: table-row;
            cursor: pointer;
            /*position: absolute;*/
            /*width: 72px!important;*/
            width: auto;
            height: 32px;
            line-height: 16px;
            text-align: left;
            /*left: 0px;*/
            /*bottom: 0px;*/
            font-size: 12px;
            white-space: normal;
        }
        .imgfileBox img{
            /*margin: 0 10px!important;*/
            width: 25px;
            height: 25px;
        }
       /* .imgfileBox:after{
            height: 32px;
        }*/
        .grey input[disabled],input:disabled,select:disabled,select[disabled]{
            color: #fff;
            opacity:1
        }
        ul {
            word-spacing: 0px;
        }
        .save_f{
            line-height: 21px;
        }
        .listhead th{
            background-color: #F7F7F7;
        }
        #content .websign input{
            background: url(/img/form/btn_a.png) no-repeat!important;
            width: 50px;
            height: 21px;
            color: #36434E;
            border: 0px!important;
            cursor: pointer;
            -webkit-appearance: button;
            font-size: 12px;
            min-height: 20px;
            line-height: 20px;
            max-width: 100%;
        }
        #content .signBtn{
            background: url(/img/form/btn_a.png) no-repeat!important;
            width: 50px;
            height: 21px;
            color: #36434E;
            border: 0px!important;
            cursor: pointer;
            -webkit-appearance: button;
            font-size: 12px;
            min-height: 20px;
            line-height: 20px;
            max-width: 100%;
        }
		.td2 .imgSrc{
			width: 100%;
            height: auto;
		}
        input[type="radio"]{
            width: 17px;
            height: 17px;
        }
        .userselect,.deptselect{
            height: 64px;
        }

        #assignmentContent .assign_task {
            height: 64px !important;
        }

        #assignmentContent .gapp_textarea {
            margin: 5px 0;
        }

        .sign_modal .layui-layer-btn0 {
            box-sizing: border-box;
        }

        .connect_work th,.connect_work td{
            padding: 5px;
        }
        
        .eiderarea {
            line-height: 25px;
            position: relative;
        }
        
        .remove_sign {
            display: none;
            position: absolute;
            bottom: 25px;
            right: 10px;
            width: 20px;
            color: red;
            text-align: center;
            /* safari 下无法点击问题 */
            cursor: pointer;
        }
        .imgfileBox{
            display: block !important;
            margin: 5px;
            float: none !important;
            left: -9px;
        }
        
        #scrollModule {
            position: fixed;
            bottom: 30px;
            right: 10px;
            width: 30px;
            height: 70px;
        }
        #scrollTop, #scrollBottom {
            cursor: pointer;
            width: 30px;
            height: 30px;
        }
        #scrollModule img {
            width: 100%;
            height: 100%;
        }
        #basic_infor .table tr {
            border-bottom: 1px solid #efefef;
        }
        /*********************评分控件start***********************************/
        .mark{
            display: inline-block;
            vertical-align: middle;
        }
        .star_list {
            height: 21px;
            margin: 50px;
            line-height: 21px;
        }

        .star_score {
            background: url(/img/workflow/form/stark2.png);
            width: 160px;
            height: 21px;
            position: relative;
        }

        .star_score a {
            height: 21px;
            display: block;
            text-indent: -999em;
            position: absolute;
            left: 0;
        }

        .star_score a:hover {
            background: url(/img/workflow/form/stars2.png);
            left: 0;
        }

        .star_score a.clibg {
            background: url(/img/workflow/form/stars2.png);
            left: 0;
        }
        /*********************评分控件end***********************************/
    </style>
</head>
<body style="display: none">
<input type="hidden" value="${sessionScope.module }" id="module">
<div class="head_top">
    <span class="head_toptitle" style="color: #3682e1;font-size: 18px;font-weight: 900;"><span style="letter-spacing: 1px;font-weight: 900;"><fmt:message code="workflow.th.liushui" />&nbsp;</span><span id="flowRunId" style="font-weight: 900;"></span></span>
    <ul style="margin-top: 10px;color: #333;font-weight: 300;" class="headTitle">
        <li><span class="head_toptitle weight" id="flowName" style="word-spacing: 0;"><fmt:message code="workflow.th.processname" />：</span></li>
        <li style="margin-top: 7px"><span class="head_toptitle weight" ><fmt:message code="workflow.th.ProcessInitiator" />：</span><span id="flowBeginUser" class="head_toptitle" style="margin-left: 2px;"></span></li>
        <li style="margin-top: 7px"><span class="head_toptitle weight" ><fmt:message code="workflow.th.ProcessInitiation" />：</span><span id="flowBeginTime" class="head_toptitle" style=" margin-left: 2px;word-spacing: 0;"></span></li>
    </ul>
</div>
<div id="basic_infor">
    <div class="basic_infor_title">
        <img src="/img/workflow/work/workformh5/leftpng.png" alt="" class="icon">
        <div class="basic_infor" style="font-size: 16px;color: #333;margin-left: 6px;font-weight: 300"><fmt:message code="url.th.EssentialInformation" /></div>
        <div class="basic_infor_title_link">
            <a href="#"></a>
        </div>
    </div>
    <div class="table">
        <table  id="content" style="font-size: 16px;">
        </table>
    </div>

    <!-- 会签意见区-->
    <div id="signModule">
        <div class="basic_infor_title">
            <img src="/img/workflow/work/workformh5/leftpng.png" alt="" class="icon">
            <div class="basic_infor" style="font-size: 16px;color: #333;margin-left: 6px;font-weight: 300"><fmt:message
                    code="work.th.CountersignedArea"/></div>
            <div class="basic_infor_title_link">
                <a href="javascript:;" class="sign_btn" style="height: 32px;line-height: 32px;font-size: 16px;color: #01adff;">常用意见</a>
            </div>
        </div>
        
        <div class="signBox"
             style="-webkit-touch-callout:initial;  /*系统默认菜单被禁用*/ -webkit-user-select:auto; /*webkit浏览器*/-khtml-user-select:auto; /*早期浏览器*/-moz-user-select:auto;/*火狐*/-ms-user-select:auto; /*IE10*/user-select:auto;">
            <textarea rows="4" id="signText" class="gapp_textarea" data-key="0" data-field-type="020000" data-must="0"
                      data-is-write="1" style="width: 90%!important;height:80px;" name="COL101214452217682884218739" placeholder=""></textarea>
            <div class="hqbox"></div>
        </div>
    </div>
    
    <%--<div class="basic_infor_title">--%>
        <%--<img src="/img/workflow/work/workformh5/leftpng.png" alt="" class="icon">--%>
        <%--<div class="basic_infor"><fmt:message code="email.th.file" /></div>--%>
        <%--<div class="basic_infor_title_link">--%>
            <%--<a href="#"></a>--%>
        <%--</div>--%>
    <%--</div>--%>

    <div class="basic_infor_title">
        <img src="/img/workflow/work/workformh5/leftpng.png" alt="" class="icon">
        <div class="basic_infor" style="font-size: 16px;color: #333;margin-left: 6px;font-weight: 300"><fmt:message code="email.th.file" /></div>
        <div class="basic_infor_title_link">
            <a href="javascript:;" class="xzbtn" style="height: 32px;line-height: 32px;font-size: 16px;color: #01adff;" onclick="btn1()">上传附件</a>
        </div>
    </div>
    <div style="padding-bottom: 8px;">
        <ul class="uploadbox" style="">

        </ul>
        <div class="photo_box" style="margin: 20px;">

        </div>
    </div>
    <div style="width: 100%;height: 45px;" class="choose_box">
        <div style="width: 100%;text-align: center">
            <%--<img class="choosewj" src="/img/workflow/work/choose_img.png" alt="" onclick="btn1()" style="height:46px;width: 100%;margin-bottom: 40px">--%>
<%--            <span class="xzbtn" style="display: none;padding: 13px 80px;background: #3b87f5;font-size: 16px;font-weight: bold; border-radius: 40px;color:#fff;" onclick="btn1()">选择文件</span>--%>
                <form id="uploadimgform" style="display:none;" target="uploadiframe" action="workUpload?module=workflow"  enctype="multipart/form-data" method="post" >
                    <input type="file"  name="file" id="uploadinputimg" uploadType="1" multiple class="w-icon5">
                </form>
        </div>
    </div>

    <!--相关流程-->
    <div class="connect_work" style="display: none;">
        <div class="basic_infor_title">
            <img src="/img/workflow/work/workformh5/leftpng.png" alt="" class="icon">
            <div class="basic_infor" style="font-size: 16px;color: #333;margin-left: 6px;font-weight: 300">相关流程</div>
            <div class="basic_infor_title_link">
                <a href="#"></a>
            </div>
        </div>
        <div style="padding: 5px 10px;">
            <table>
                <thead><tr><th style="min-width: 60px;">流程类型</th><th>流程名称</th></tr></thead>
                <tbody class="connect_work_table"></tbody>
            </table>
        </div>
    </div>

    <div class="done">
        <button class="type_done" id="lctbtn" style="padding: 13px 27px;margin-left: 20px;"><fmt:message code="workflow.th.chart" /></button>
        <button class="type_done" id="saveBtn"><fmt:message code="global.lang.save" /></button>
        <button class="type_done" id="turnBtn" style="  margin-left: 10px;background-color: #3cb371;"><fmt:message code="workflow.th.Transfer" /></button>
        <button class="type_done" id="backBtn" style="background-color: #ec5959;display: none;margin-left: 20px;"><fmt:message code="workflow.th.backbtn" /></button>
        <button class="type_done" id="deleteBtn"  style="margin-left: 20px;"><fmt:message code="menuSSetting.th.deleteMenu" /></button>
        <button class="type_done" id="weituo" style="display: none" onclick="weituoFuc()"><fmt:message code="workflow.th.Entrust" /></button>

        <button class="type_done" id="formInfo" style="font-size: 16px;">原始表单</button>
        <button class="type_done" id="opflagturn" style="display: none;background-color: #3cb371;">办理完毕</button>
        <button class="type_done" id="addSign" style="display: none;padding: 14px 16px;font-size: 14px;">增加经办人</button>
        <button class="type_done" id="assignment" style="display: none">交办</button>
        <button class="type_done" id="assignmentDetail" style="display: none; padding: 13px 19px;">交办详情</button>
    </div>
    <div id="weituoBox" style=" top: 114px; position: fixed; height: 100%;width: 100%;background-color: #ffffff;display: none;">
        <div class="basic_infor_title" style="">
            <img src="/img/workflow/work/workformh5/leftpng.png" alt="" class="icon">
            <div class="basic_infor" style="font-size: 16px;color: #333;margin-left: 6px;font-weight: 300">工作流委托</div>
            <div class="basic_infor_title_link">
                <a href="#"></a>
            </div>
        </div>
        <div id="weituocontent" style="padding-left: 16px;padding-right: 16px;padding-bottom: 20px;overflow:scroll">
            <table style="width: 100%;font-size: 16px">
                <tbody>
                <tr style="border-bottom: 1px solid #f7f7f7;">
                    <td class="td1 grey1">
                        <div>当前步骤</div>
                    </td>
                    <td class="td2">
                        <input id="step" class="AUTO gapp_input gapp_form grey" type="text" value="" readonly="readonly">
                    </td>
                </tr>
                <tr>
                    <td class="td1">
                        <div class="textareaclass">委托对象</div>
                    </td>
                    <td class="td2">
                        <textarea id="toUser" class="gapp_textarea userselect userselecth5" readonly="readonly" orgwidth="150" user_id="" username="" selectId="1"></textarea>
                    </td>
                </tr>
                </tbody>
            </table>
        </div>
        <div style="text-align: center">
            <button class="type_done" id="weituosure" style="padding: 8px 23px;margin-right: 20px;">确定</button>
            <button class="type_done" id="weituofoot" style=" padding: 8px 23px;background-color: #ec5959;">返回</button>
        </div>
    </div>
    <div id="assignmentBox" style=" top: 114px; position: fixed; height: 100%;width: 100%;background-color: #ffffff;display: none;">
        <div class="basic_infor_title" style="">
            <img src="/img/workflow/work/workformh5/leftpng.png" alt="" class="icon">
            <div class="basic_infor" style="font-size: 16px;color: #333;margin-left: 6px;font-weight: 300">工作交办</div>
            <div class="basic_infor_title_link" style="height: 32px;">
<%--                <a href="javascript:;" id="assignmentSign" style="height: 32px; line-height: 32px;">选择常用意见</a>--%>
            </div>
        </div>
        <div id="assignmentContent" style="padding-left: 16px;padding-right: 16px;padding-bottom: 20px;overflow:scroll">
            <table style="width: 100%;font-size: 16px">
                <tbody>
<%--                    <tr style="border-bottom: 1px solid #f7f7f7;">--%>
<%--                        <td class="td1 grey1">--%>
<%--                            <div>交办内容</div>--%>
<%--                        </td>--%>
<%--                        <td class="td2">--%>
<%--                            <textarea rows="2" class="gapp_textarea assign_task" orgheight="64"></textarea>--%>
<%--                        </td>--%>
<%--                    </tr>--%>
                    <tr style="border-bottom: 1px solid #f7f7f7;">
                        <td class="td1 grey1">
                            <div>办理人</div>
                        </td>
                        <td class="td2">
                            <textarea id="changePerson" class="gapp_textarea userselect userselecth5" readonly="readonly" orgwidth="150" user_id="" username="" selectId="1"></textarea>
                        </td>
                    </tr>
<%--                    <tr style="border-bottom: 1px solid #f7f7f7;">--%>
<%--                        <td class="td1 grey1">--%>
<%--                            <div>是否允许填写会签意见</div>--%>
<%--                        </td>--%>
<%--                        <td class="td2" style="padding: 5px 0;">--%>
<%--                            <input type="radio" name="opinionType" style="vertical-align: text-bottom;" checked> 是--%>
<%--                            <input type="radio" name="opinionType" style="vertical-align: text-bottom;margin-left: 10px;"> 否--%>
<%--                        </td>--%>
<%--                    </tr>--%>
<%--        移动端交办上传附件 TODO            --%>
<%--                    <tr style="border-bottom: 1px solid #f7f7f7;">--%>
<%--                        <td class="td1 grey1">--%>
<%--                            <div>附件</div>--%>
<%--                        </td>--%>
<%--                        <td class="td2" style="padding: 5px 0;">--%>
<%--                            <a href="javascript:;" class="assign_file" name="assignfile" style="color: #3870d7;" src="/img/fileupload.png" onclick="phoneimgupload(this)"><img src="/img/icon_uplod.png" style="float: none;width: 16px;height: 16px;vertical-align: text-top;">附件上传</a>--%>
<%--                        </td>--%>
<%--                    </tr>--%>
                    <tr style="border-bottom: 1px solid #f7f7f7;">
                        <td class="td1 grey1">
                            <div>提醒</div>
                        </td>
                        <td class="td2" style="padding: 5px 0;">
                            <div><input type="checkbox" name="smstype" value="5" style="margin-top: -2px;vertical-align: middle;" checked> 发送事务提醒消息</div>
                            <div><input type="checkbox" name="smstype" value="6" style="margin-top: -2px;vertical-align: middle;" > 使用手机短信提醒</div>
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
        <div style="text-align: center">
            <button class="type_done" id="assignmentsure" style="padding: 8px 23px;margin-right: 20px;">确定</button>
            <button class="type_done" id="assignmentfoot" style=" padding: 8px 23px;background-color: #ec5959;">返回</button>
        </div>
    </div>
</div>
<div class="lct" style="display: none">
    <div class="lct_title">
        <fmt:message code="workflow.th.chart" />
    </div>
    <div class="lct_body">
        <ul class="lct_info">
            <li><span class="head_toptitle weight" style="color:#0074ec;"><fmt:message code="workflow.th.SerialRegistration" /></span></li>
            <li><span class="head_toptitle weight" ><fmt:message code="workflow.th.HostedAdministrator" /></span><span class="head_toptitle" style="color: #73a282;margin-left: 2px;"><fmt:message code="workflow.th.second" /></span></li>
            <li><span class="head_toptitle weight" ><fmt:message code="workflow.th.StartedOn" />：</span><span class="head_toptitle" style="font-weight: 600;    margin-left: 2px;">2017-07-26 19:24</span></li>
        </ul>
    </div>
</div>
<div id="listbox" class="listbox" style="top: 0px;overflow: auto; position: fixed;width: 100%;background-color: #ffffff;display: none;">
    <div style="width:100%;margin:0 auto;text-align:center;margin-top: 12px;">列表控件详情</div>
    <div id="listcontent"></div>
    <div id="foot" style="text-align: center">
        <button class="type_done" id="list_btn_close" style=" padding: 8px 23px;">保存</button>
    </div>

</div>
<div id="readcommentstpl" class="layui-fluid layui-form " style="display: none">
    <div class="layui-row layui-rows">
        <div class="layui-col-md12">
            <fieldset class="layui-elem-field layui-field-title" style="margin: 0;">
                <legend style="display: inline-block;width: 5em;border: 0;margin-bottom: 0;"> [送]方式</legend>
            </fieldset>

            <ul class="fl clearfix" style="padding-left: 35px;box-sizing: border-box;">
                <li class="layui-badge" style="margin: 5px">请</li>
                <li class="layui-badge" style="margin: 5px">送</li>
                <li class="layui-badge" style="margin: 5px">拟请</li>
                <li class="layui-badge" style="margin: 5px">转</li>
                <li class="layui-badge" style="margin: 5px">有请</li>
                <li class="layui-badge" style="margin: 5px">请各位领导</li>

            </ul>
        </div>
    </div>
    <div class="layui-row layui-rows" style="padding-top: 22px;">
        <fieldset class="layui-elem-field layui-field-title" style="margin: 0;">
            <legend style="display: inline-block;width: 9em;border: 0;margin-bottom: 0;">请选择部门和人员</legend>
        </fieldset>

        <div class="layui-col-md12">

            <select name="" class="select1" id="select11" style="vertical-align: middle;width: 29%;    margin-left: 35px; margin-right: 10%;" num="1">
                <option value="">请选择部门</option>

            </select>
            <select name="" id="select2" style="vertical-align: middle;width: 29%;" num="2">
                <option value="">请选择人员</option>

            </select>
        </div>

    </div>
    <div class="layui-row layui-rows">
        <div class="layui-col-md12">
            <fieldset class="layui-elem-field layui-field-title" style="margin:0">
                <legend style="display: inline-block;width: 5em;border: 0;margin-bottom: 0;">处理方式</legend>
            </fieldset>

            <ul class="fl clearfix" style="padding-left: 35px;box-sizing: border-box;">
                <li class="layui-badge" style="margin: 5px">办理</li>
                <li class="layui-badge" style="margin: 5px">已阅</li>
                <li class="layui-badge" style="margin: 5px">阅示</li>
                <li class="layui-badge" style="margin: 5px">阅</li>
                <li class="layui-badge" style="margin: 5px">提出意见</li>
                <li class="layui-badge" style="margin: 5px">批示</li>
                <li class="layui-badge" style="margin: 5px">协办</li>
                <li class="layui-badge" style="margin: 5px">研酌</li>
                <li class="layui-badge" style="margin: 5px">同意</li>
                <li class="layui-badge" style="margin: 5px">不同意</li>
                <li class="layui-badge" style="margin: 5px">研阅</li>
                <li class="layui-badge" style="margin: 5px">复印</li>
            </ul>
        </div>


    </div>
    <div class="centertion" style="width:95%;margin-left: 35px;margin-top: 10px; box-sizing: border-box">
        <textarea name="" id="" cols="30" rows="4" style="width: 84%;"></textarea>
    </div>
</div>
    <div id="scrollModule">
        <div id="scrollTop">
            <img src="/img/workflow/m/scrollTop.png">
        </div>
        <div id="scrollBottom" style="margin-top: 10px">
            <img src="/img/workflow/m/scrollBottom.png">
        </div>
    </div>

<script src="../../js/template.js"></script>
<script src="../../lib/laydate/laydate.js"></script>
<script src="../../js/mustache.min.js"></script>
<script src="../../js/base/base.js?20200116.1"></script>
<script src="/lib/layer/layer.js?20201106"></script>
<%--<script src="/lib/ueditor/ueditor.config.js" type="text/javascript" charset="utf-8"></script>--%>
<%--<script src="/lib/ueditor/ueditor.all.js" type="text/javascript" charset="utf-8"></script>--%>
<%--<script src="/lib/ueditor/UEcontroller.js" type="text/javascript" charset="utf-8"></script>--%>
<%--无主办会签问题--%>
<script src="../../js/base/workformbase.js?20201030.1"></script>
<script type="text/javascript" src="../../js/workflow/work/calculateFormitem.js?20201014.2"></script>
<script type="text/javascript" src="../../js/workflow/work/startScore.js"></script>
<script src="../../js/workflow/work/workform.js?20201030.1"></script>
<script src="../../js/workflow/work/m/H5websign_main.js?20190516.1"></script>
<script src="/js/workflow/work/m/jdate.min.js?20190814.1"></script>
<script src="../../js/workflow/work/m/workformh5.js?20201030.1"></script>
<%--无主办会签问题--%>
<%--<script src="../../js/base/workformbase.js?"></script>--%>
<script src="../../lib/jquery.form.min.js" ></script>
<script src="../../js/jquery/jquery.cookie.js"></script>
<script src="../../lib/qrcode.js"></script>
<script src="../../lib/layer/layer.js?20201106"></script>
<!-- 移动端手写控件 begin -->
<script src="../../lib/jSignature-master/libs/modernizr.js?20190710"></script>
<script src="../../lib/jSignature-master/libs/jSignature.min.noconflict.js?20190710"></script>
<!-- 移动端手写控件 end -->

<script src="/lib/img2blob/js/img2blob.js?201907311" type="text/javascript"></script>
<script type="text/javascript" src="/js/workflow/work/writeSign.js?20200106.2"></script>

<link rel="stylesheet" href="../../lib/kinggrid/dialog/artDialog/ui-dialog.css">
<link rel="stylesheet" href="../../lib/kinggrid/core/kinggrid.plus.css">
<link rel="stylesheet" type="text/css" href="../../css/workflow/m_reset.css">
<link rel="stylesheet" href="../../lib/layui/layui/css/layui.css">

<%--<script type="text/javascript" src="../../lib/kinggrid/core/kinggrid.min.js"></script>--%>
<%--<script type="text/javascript" src="../../lib/kinggrid/core/kinggrid.plus.min.js"></script>--%>
<%--<script type="text/javascript" src="../../lib/kinggrid/dialog/artDialog/dialog.js"></script>--%>

<!-- html签章核心JS -->
<%--<script type="text/javascript" src="../../lib/kinggrid/signature.min.js"></script>--%>
<!-- PC端附加功能 -->
<%--<script type="text/javascript" src="../../lib/kinggrid/signature.pc.min.js"></script>--%>
<!-- 移动端端附加功能 -->
<%--<link rel="stylesheet" href="../../lib/kinggrid/core/kinggrid.plus.mobile.css">--%>
<%--<script type="text/javascript" src="../../lib/kinggrid/signature.mobile.min.js"></script>--%>
<%--<script src="/js/base/vconsole.min.js"></script>--%>
<%--<script type="text/javascript" src="../../lib/kinggrid/signature_pad.min.js"></script>--%>
<%--<script type="text/javascript" src="../../lib/kinggrid/jquery.timer.dev.js"></script>--%>
<!-- 金格签章 end -->

<script type="text/javascript" src="/js/workflow/work/macroSign.js?20191115.1" ></script>
<script type="text/javascript" src="/js/workflow/work/newDataControl.js" ></script>

<script>
    if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {

    } else if (/(Android)/i.test(navigator.userAgent)) {
        beforeToken = $.GetRequest().acces_token||'';
    }
    
    //查看当前流程是否已办结, 已办结跳转至详情页面
    $.ajax({
        url: '/workflow/work/selectFind',
        type: 'GET',
        data: {
            flowId: $.GetRequest().flowId,
            prcsId: $.GetRequest().flowStep,
            flowPrcs: $.GetRequest().prcsId,
            runId: $.GetRequest().runId
        },
        success: function (res) {
            if (res.flag && res.object == 'err') {
                setTimeout(function () {
                    layer.msg('当前流程已办结', {time: 1000}, function () {
                        if ('EWC'==$.GetRequest().type){
                            var href = location.href.replace('workformh5', 'workformh5PreView');
                            location.href = href;
                        }else{
                        if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {
                            try{
                                window.webkit.messageHandlers.finishWork.postMessage({});
                            }catch(err){
                                finishWork();
                            }
                        } else if (/(Android)/i.test(navigator.userAgent)) {
                            Android.finishWebActivity();
                        } else {
                            var href = location.href.replace('workformh5', 'workformh5PreView');
                            location.href = href;
                        }
                        }
                    });
                }, 500);
            }
        },
        error: function (err) {
            console.log(err);
        }
    })
    var classDept = '';
    <%--阅文意见下拉菜单部门--%>
    // $.ajax({
    //     url: "../../department/getAlldept",
    //     type: 'get',
    //     data: {},
    //     dataType: 'json',
    //     success: function (obj) {
    //         var data = obj.obj;
    //         departmentData = digui(data, 0);
    //         var str = departmentChild(departmentData, '<option value="-1">请选择部门</option>', 0, -1);
    //         $('#select11').html(str);
    //     },
    //     error: function () {
    //     }
    // });
    $('#listbox').height($(document).height())
    function weituoFuc(){
        $('#weituoBox').show();
        $('#weituoBox').siblings().hide();
    }
    var projectId;
    //定制化需求
    $.get('/syspara/selectProjectId',function (res) {
        projectId=res.object
        if(res.object=='dazu'){
            $("#signModule .basic_infor").text('处理意见区')
        }
    });
    /**********************与移动端对接webview的初始化调用函数开始*****************************/
    function ready(){
        var opflag =  $.getQueryString("opflag") || '1';   // ios新建工作流兼容ios419版本 不传opflag 还有workform.js存在判断
        if(opflag != 0){
            if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {
                try{
                    window.webkit.messageHandlers.rightTitle.postMessage({'title':'<fmt:message code="workflow.th.Transfer" />','name':'321','function':'turn'});
                }catch(err){
                    rightTitle('<fmt:message code="workflow.th.Transfer" />','321','turn');
                }
            } else if (/(Android)/i.test(navigator.userAgent)) {
                //alert(navigator.userAgent);
                Android.rightTitle('<fmt:message code="workflow.th.Transfer" />','321','turn');
            }
        }else{
            noneperson();
        }
    }
    /**********************结束*****************************/
    /**********************与服务端对接移动端签章函数开始*****************************/
    function addSeal(e){
        if(e.parents('.td2').find('.sealImg').length == 0){
            var id = e.siblings('input[data-type=djsign]').attr('name');
            layer.open({
                type: 2,
                shade:true,
                area: ['360px', '500px'],
                scrollbar:true,
                content: ["/common/selectSeal?type=H5&ITEM=" + id, 'yes']
            });
        }else{
            alert('请删除该控件的印章数据！');
        }


    }
    window.addSealImg = function(id,seal_id){
        var url = location.origin+"/seal/querySealById?sealId="+seal_id;
        var src = '';
        var text = '';
        $.ajax({
            type:'post',
            url:url,
            dataType:'text',
            async:false,
            beforeSend : function(request) {
                if(beforeToken != ''){
                    request.setRequestHeader("Authorization", 'Bearer '+beforeToken);
                }
            },
            success:function(obj){
                layer.closeAll();
                layer.open({
                    area: ['80%', '200px'],
                    closeBtn: 0,
                    title:'输入密码',
                    content: '<input type="password" placeholder="请输入印章密码" id="SealPaseWord" style="width: 70%;height: 30px;border-radius: 4px;background: #f8f8f8;border: 1px solid #d4cdcd!important;font-size: 14px;text-indent: 5px;margin-top: 10px;">',
                    btn:['确定', '取消'],
                    success: function(layero,index){

                    },
                    yes:function(index, layero){
                        var psw = $('#SealPaseWord').val();
                        if(obj&&obj!=''&&obj.indexOf('STRDATA:') > -1&&obj.split('STRDATA:')[1] != ''){
                            $.ajax({
                                type:'post',
                                url:'/seal/parseSealToWebsign',
                                data:{
                                    'sealData':obj.split('STRDATA:')[1],
                                    'psw':psw,
                                    'sealName':id+'_seal',
                                    'sealPosition':'SIGN_POS_'+id,
                                    'sealX':'0',
                                    'sealY':'0',
                                    'oriData':''
                                },
                                beforeSend : function(request) {
                                    if(beforeToken != ''){
                                        request.setRequestHeader("Authorization", 'Bearer '+beforeToken);
                                    }
                                },
                                dataType:'text',
                                success:function(objthis){
                                    if($(objthis).eq(0).find('seal_gif').html() == ''){
                                        alert('服务未授权，无法获取签章数据！')
                                        layer.closeAll();
                                    }else{
                                        if($(objthis).eq(0).find('verifyRes').html() == 'true'){
                                            var deleteImg = 'deleteImg($(this),1)';
                                            var imgSrc = '<img src="data:image/png;base64,'+ $(objthis).eq(0).find('seal_gif').html() +'" class="imgSrc sealImg" atturl="'+ $(objthis).eq(1).html() +'" onclick="'+ deleteImg +'">';
                                            $('#'+id).parent().siblings('.divDJBox').append(imgSrc);
                                            layer.closeAll();
                                        }else{
                                            alert('密码错误！')
                                        }
                                    }

                                },error:function(){

                                }
                            })

                        }else{
                            alert('印章失效，请重新选择！');
                        }
                    }
                });


            },error:function () {
                alert('印章失效，请联系管理员！');
                layer.closeAll();
            }
        });

    }
    /**********************结束*****************************/
    /**********************与移动端对接公文正文 传输已存在正文文件url得函数*****************************/
    function documentInitUrl(){
        if($.getQueryString("tableName") && $.getQueryString("tableName") == 'document'){
            $.ajax({
                url: "/document/selectDocById",
                type: "get",
                dataType: "json",
                beforeSend : function(request) {
                    if(beforeToken != ''){
                        request.setRequestHeader("Authorization", 'Bearer '+beforeToken);
                    }
                },
                data: {id: $.getQueryString("tabId"), randomNum: Math.random()},
                success: function (res) {
                    if (res.flag) {
                        //优先展示pdf，如果没有pdf，则展示word，没有word，直接传文字
                        if(res.object.aipAttUrl){
                            url = res.object.aipAttUrl;
                            url = encodeURI(url);
                            url = location.protocol +"//"+location.host+"/download?"+url;
                        }else{
                            if (!res.object.wordAttUrl) {
                                url = '该条公文未生成相应绑定的正文文件！';
                            } else {
                                url = res.object.wordAttUrl;
                                url = encodeURI(url);
                                url = location.protocol +"//"+location.host+"/download?"+url;
                            }
                        }
                        if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {

                            try{
                                window.webkit.messageHandlers.InitUrl.postMessage({'url':url});
                            }catch(err){
                                InitUrl(url);
                            }
                        } else if (/(Android)/i.test(navigator.userAgent)) {
                            Android.InitUrl(url);
                        }
                    }
                }
            });
        }
    }
    /**********************结束*****************************/
	/**********************与移动端对接webview的移动端手写函数*****************************/
    function handWrite(e){
        if(e.parents('.td2').find('.hwImg').length == 0){
            var id = e.siblings('input[data-type=djsign]').attr('name');
            var window_size = e.attr('window_size');
            if(window_size == ''){
                var width = '800';
                var height = '480';
            }else{
                var width = window_size.split(',')[0];
                var height = window_size.split(',')[1];
            }
            if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {
                try{
                    window.webkit.messageHandlers.handWriteMobile.postMessage({'id':id});
                }catch(err){
                    handWriteMobile(id);
                }

            } else if (/(Android)/i.test(navigator.userAgent)) {
                //alert(navigator.userAgent);
                Android.handWriteMobile(id,width,height);
            }
        }else{
            alert('请删除该控件的手写数据！');
        }


    }
    /**********************结束*****************************/
	/**********************与移动端对接webview的移动端base64回显函数*****************************/
    function DjSign(string,id,type,username){
		var url = 'data:image/png;base64,'+string;
		if(type == undefined||type == 'hw'){
		    var classtype = 'hwImg';
        }else{
            var classtype = 'sealImg';
        }
        if(!username||username == workForm.tool.MacrosData.data.sYS_USERNAME){
            var deleteImg = 'deleteImg($(this),1)';
        }else{
            var deleteImg = 'deleteImg($(this),2)';
        }
		var url = 'data:image/png;base64,'+string;
		var imgSrc = '<img src="'+ url +'" class="imgSrc '+ classtype +'" atturl="'+ string +'" onclick="'+ deleteImg +'">';
		$('#'+id).parent().siblings('.divDJBox').append(imgSrc);

    }
    /**********************结束*****************************/
    /**********************与移动端对接签章、手写控件生成图片删除功能*****************************/
    function deleteImg(e,type){
        if(type == '1'){
            //询问框
            var index = layer.confirm('您确定要删除这个印章/手写数据么？', {
                btn: ['确定','取消'] //按钮
            }, function(){
                var obj = e.parents('.td2').find('input[type=hidden]');
                var val = e.parents('.td2').find('input[type=hidden]').val();
                if(val.indexOf('DATA_HW:') > -1&&val.indexOf('DATA_SEAL:') > -1){
                    var hw = val.split('DATA_HW:')[1].split('DATA_SEAL:')[0];
                    var seal = val.split('DATA_HW:')[1].split('DATA_SEAL:')[1];
                    if(e.hasClass('hwImg')){
                        hw = '';
                    }else{
                        seal = '';
                    }
                    obj.val('DATA_HW:'+hw+'DATA_SEAL:'+seal)
                }
                e.remove();
                layer.msg('删除成功', {icon: 1});
            }, function(){
                layer.close(index);
            });
        }else if(type == '2'){
            alert("您无权操作这个印章/手写数据，无法删除！")
        }
    }
    /**********************结束*****************************/
    /**********************与移动端交互 调用移动端选取文件的方法*****************************/
    function btn1(e){
        if($.getQueryString("type") == 'EWC'){
            // console.log('uploadimgform');
            // alert('企业微信移动端工作流公共附件功能正在开发中！');
            $("#uploadinputimg").attr('uploadType','1');
            $('#uploadimgform').attr('action','workUpload?module=workflow&flowPrcs='+$.getQueryString("flowStep")+'&runId='+$.getQueryString("runId"));
            $("#uploadinputimg").trigger("click");
        }else{
            $('.choosewj').attr('src','/img/workflow/work/choose_imgclick.png')
            btn('imgadd1',0)
        }

    }
    function btn(cb,num){
        if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {
            try{
                window.webkit.messageHandlers.addImage.postMessage({'function':cb,'num':num});
            }catch(err){
                addImage(cb,num);
            }

        } else if (/(Android)/i.test(navigator.userAgent)) {
            //alert(navigator.userAgent);
            Android.addImage(cb,num);
        }
        $('.choosewj').attr('src','/img/workflow/work/choose_img.png')
    }
    function getCookie (key) {
        var arr=document.cookie.split('; '); //多个cookie之间是用;+空格连接的
        for (var i = 0; i < arr.length; i++) {
            var arr2=arr[i].arr.split('=');
            if(arr2[0]==key){
                return arr2[1];
            }
        }
        return false;//如果函数没有返回值，得到的结果是undefined
    }
    /************调用移动端原始表单查看的方法************************/
    function formInfo() {
        if($.getQueryString("type") == 'EWC'){
            window.location.href = '/workflow/work/workformPreView?flowId=' + globalData.flowId + '&flowStep=&prcsId=&runId=' + globalData.flowRun.runId + '&formInfo=formInfo';
        }else{
            if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {
                try{
                    window.webkit.messageHandlers.formInfoUrlLink.postMessage({'url':'/workflow/work/workformPreView?flowId=' + globalData.flowId + '&flowStep=&prcsId=&runId=' + globalData.flowRun.runId + '&formInfo=formInfo','name':'原始表单'});
                }
                catch(err) {
                    formInfoUrlLink('/workflow/work/workformPreView?flowId=' + globalData.flowId + '&flowStep=&prcsId=&runId=' + globalData.flowRun.runId + '&formInfo=formInfo','原始表单');
                }
            } else if (/(Android)/i.test(navigator.userAgent)) {
                Android.formInfoUrlLink('/workflow/work/workformPreView?flowId=' + globalData.flowId + '&flowStep=&prcsId=&runId=' + globalData.flowRun.runId + '&formInfo=formInfo','原始表单');
            }
        }

    };
    function imgadd1(img,name,type){
        var arr = img.split(',');
        var name_arr = name.split(',');

        if(type == 1){
            var img = '';
            for(var i=0;i<arr.length -1;i++){
                var url =  arr[i];

                img += '<img id="blah"  src="'+ arr[i] +'" onclick="anios($(this))" style="width:50px;height:50px;margin-right: 10px;margin-bottom: 10px;" url="'+url +'" name="'+ name_arr[i] +'">';
            }
            $('.photo_box').append(img);
        }else{
            var name_str = '';
            for(var i=0;i<name_arr.length -1;i++){
                var url = arr[i];
                if($.getQueryString("type") == 'EWC'){
                    name_str += '<p><a style="display: none" href="'+url+'">'+ name_arr[i] +'</a></p>'
                }else {
                    name_str += '<p onclick="anios($(this))" url="'+url+'"  name="'+ name_arr[i] +'">'+ name_arr[i] +'</p>'
                }
            }
            $('.uploadbox').css('min-height', '50px')
            $('.uploadbox').append(name_str);
        }
    }
    function anios(e){
        var url = e.attr('url');
        var name = e.attr('name');
        if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {
            if($.getQueryString("type") == 'EWC'){
                window.open(url)
            }else{
                try{
                    window.webkit.messageHandlers.overLookFile.postMessage({'url':url,'name':name});
                }catch(error){
                    overLookFile(url,name);
                }
            }
        } else if (/(Android)/i.test(navigator.userAgent)) {
            if($.getQueryString("type") == 'EWC'){
                window.open(url)
            }else{
                Android.overLookFile(url,name);
            }
        } else {
            window.open(url);
        }
    }
    function anios1(e){
        if(e.attr('url').indexOf('http:') >-1){
            var url = e.attr('url');
        }else{
            if (window["context"] == undefined) {
                if (!window.location.origin) {
                    window.location.origin = window.location.protocol + "//" + window.location.hostname + (window.location.port ? ':' + window.location.port: '');
                }
                window["context"] = location.origin;
            }
            var domain = document.location.origin;
            var url = domain+e.attr('url');
        }
        if(e.hasClass('fileupload_data')){
            var url = domain+'/download?'+e.attr('url');
        }
        var name = e.attr('names');
        if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {
            try{
                window.webkit.messageHandlers.overLookFile.postMessage({'url':url,'name':name});
            }catch(error){
                overLookFile(url,name);
            }
        } else if (/(Android)/i.test(navigator.userAgent)) {
            Android.overLookFile(url,name);
        }
    }
    /**********************结束*****************************/
    /**********************与移动端交互 页面加载后 将附件的图片添加 初始化页面附件查看方式*****************************/
    imptarget = '';
    function phoneimgupload(e) {
        imptarget = $(e);
        if($.getQueryString("type") == 'EWC'){
            // alert('附件、图片上传控件正在开发！');
            if($(e).attr('src') == '/img/fileupload.png'){
                $("#uploadinputimg").attr('uploadType','4');
            }else{
                $("#uploadinputimg").attr('uploadType','3');
            }

            $('#uploadimgform').attr('action','/upload?module=workflow');
            $("#uploadinputimg").trigger("click");
        }else{
            if($(e).attr('src') == '/img/fileupload.png'){
                btn("imgupload4",2)
            }else{
                btn("imgupload3",1)
            }
        }
    }
    function imgupload3(img,name,type){
        var url = img.split(',');
        var listStr = '';
        for(var i= 0;i<url.length;i++){
            if(url[i]!=''){
                var names = name.split(',')[i];
                var thisspan = names;
                if(thisspan != ''){
                    if(thisspan.split('.')[0].length > 8){
                        var thisspan = thisspan.split('.')[0].substr(0,8)+'…'+thisspan.split('.')[1];
                    }
                }
                if (type == 3) {
                    listStr += '<div style="display:  inline-block;position:  relative;float: left;height: 90px;"><img name="'+imptarget.attr('name')+'" names="'+names+'" onclick="anios1($(this))" src="'+url[i]+'" url="'+url[i]+'" style="cursor: pointer;"  id="'+imptarget.attr('name')+'" title="'+imptarget.attr('title')+'" align="absmiddle" style=""  class="imgupload_data"    width="'+imptarget.attr('width')+'" height="'+imptarget.attr('height')+'"/><span class="uploadImg">'+ thisspan +'</span></div>';
                } else {
                    listStr += '<div style="display:  inline-block;position:  relative;float: left;height: 90px;"><img name="'+imptarget.attr('name')+'" names="'+names+'" onclick="anios1($(this))" src="/xs?'+url[i].split('/download?')[1]+'" url="/xs?'+url[i].split('/download?')[1]+'" style="cursor: pointer;"  id="'+imptarget.attr('name')+'" title="'+imptarget.attr('title')+'" align="absmiddle" style=""  class="imgupload_data"    width="'+imptarget.attr('width')+'" height="'+imptarget.attr('height')+'"/><span class="uploadImg">'+ thisspan +'</span></div>';
                }
            }
        }
        imptarget.before(listStr).parent().css({
            'padding-top': '5px',
            'padding-bottom': '5px'
        });
        imptarget = '';
    }
    function imgupload4(img,name,type){
        var arr = img.split(',');
        var listStr = '';
        for(var i=0;i<arr.length;i++){
            if(arr[i]!=''){
                var name_arr = name.split(',')[i];
                var thisspan = name_arr;
                if(thisspan != ''){
                    if(thisspan.split('.')[0].length > 8){
                        var thisspan = thisspan.split('.')[0].substr(0,8)+'…'+thisspan.split('.')[1];
                    }
                }
                var http = 'http://'+ window.location.host;
                var iconImgType = {
                    txt : '/img/icon_file.png',
                    jpg : '/img/icon_image.png',
                    png : '/img/icon_image.png',
                    pdf :  '/img/icon_pdf.png',
                    ppt : '/img/icon_ppt.png',
                    pptx :  '/img/icon_ppt.png',
                    doc : '/img/icon_word.png',
                    docx : '/img/icon_word.png',
                    xls :  '/img/icon_excel.png',
                    xlsx :  '/img/icon_excel.png'
                };
                var attrnametype = name.split('.')[1];
                if(attrnametype.replace(/^(.*[n])*.*(.|n)$/g, "$2") == ','){
                    attrnametype = attrnametype.split(',')[0];
                }
                if(iconImgType[attrnametype] == undefined){
                    var src = '/img/icon_file.png';
                }else{
                    var src = iconImgType[attrnametype];
                }
                if (type == 4) {
                    listStr += '<div style="display:  inline-block;position:  relative;float: left;height: 90px;"><img atturl="'+ arr[i] +'" name="'+imptarget.attr('name')+'" names="'+name_arr[0]+'" onclick="anios1($(this))" src="'+ src +'" url="'+ arr[i] +'" style="cursor: pointer;"  id="'+imptarget.attr('name')+'" title="'+imptarget.attr('title')+'" align="absmiddle" style=""  class="fileupload_data"    width="'+imptarget.attr('width')+'" height="'+imptarget.attr('height')+'"/><span class="uploadImg">'+ thisspan +'</span></div>';
                } else {
                    listStr += '<div style="display:  inline-block;position:  relative;float: left;height: 90px;"><img atturl="'+ arr[i].split('/download?')[1] +'" name="'+imptarget.attr('name')+'" names="'+name_arr[0]+'" onclick="anios1($(this))" src="'+ src +'" url="'+ arr[i].split('/download?')[1] +'" style="cursor: pointer;"  id="'+imptarget.attr('name')+'" title="'+imptarget.attr('title')+'" align="absmiddle" style=""  class="fileupload_data"    width="'+imptarget.attr('width')+'" height="'+imptarget.attr('height')+'"/><span class="uploadImg">'+ thisspan +'</span></div>';
                }

            }
        }
        imptarget.before(listStr).parent().css({
            'padding-top': '5px',
            'padding-bottom': '5px'
        });
        imptarget = '';
    }
/*******************结束*****************************/

    $(function () {
        var opflag =  $.getQueryString("opflag") || '1';    // ios新建工作流兼容ios419版本 不传opflag 还有workform.js存在判断
        var istend = false;
        /**************判断获取当前流程是否是无主办会签类型******************************************/
        noneperson(function(){
            /**************处理多行文本框内容超过设定得高度进行自适应*************************************/
            $.each($("textarea"), function(i, n){
                if(n.scrollHeight != 0){
                    $(n).css("height", n.scrollHeight + "px");
                }
            })
            /**************结束*************************************/
        });
        /**************结束*************************************/

        var sign_arr=[];
        $('#weituofoot').click(function () {
            $('#weituoBox').hide().siblings().show();
            $('#assignmentBox').hide();
        });
        $('#weituosure').click(function () {
            var entrstUser=$("#toUser").attr("user_id")||'';
            if(entrstUser.indexOf(',')){
                entrstUser = entrstUser.split(',')[0];
            }
            if(entrstUser==undefined||entrstUser.length==0){
                $.layerMsg({content: "必须指定被委托人", icon: 2});
                return false;
            }
            $.ajax({
                url: "/workflow/work/entrustUser",
                type: "post",
                dataType: "json",
                data: {
                    id:globalData.flowRunPrcs.id,
                    runId:globalData.flowRunPrcs.runId,
                    prcsId:globalData.flowRunPrcs.prcsId,
                    flowPrcs:globalData.flowRunPrcs.flowPrcs,
                    prcsFlag:globalData.flowRunPrcs.prcsFlag,
                    entrstUser:entrstUser,
                    userId:globalData.flowRunPrcs.userId,
                    opFlag:globalData.flowRunPrcs.opFlag,
                    affair:'1',
                    message:'0',
                    context:'工作流委托提醒：'+globalData.flowRun.runName,
                    flowId:globalData.flowId
                },
                beforeSend : function(request) {
                    if(beforeToken != ''){
                        request.setRequestHeader("Authorization", 'Bearer '+beforeToken);
                    }
                },
                success: function (data) {
                    if (data.flag) {
                        if($.getQueryString("type") == 'EWC'){
                            var type = '?type=EWC';
                        }else{
                            var type = '';
                        }
                        window.location.href = 'zhuanjiaoh5'+type;
                    } else {
                        if(data.msg=='error'){
                            $.layerMsg({content: "委托失败", icon: 2,time:1500},function () {

                            });
                        }else{
                            $.layerMsg({content: data.msg, icon: 2,time:1500},function () {

                            });
                        }
                    }

                }
            })

        });
        // 取消工作交办
        $('#assignmentfoot').click(function () {
            $('#assignmentBox').hide().siblings().show(0, function () {
                var $con = $('#assignmentContent');
                $('.assign_task', $con).val('');
                $('#changePerson', $con).val('').attr('user_id', '');
                // $('input[name="opinionType"]', $con).eq(0).prop("checked", true);
                // $('input[name="opinionType"]', $con).eq(1).prop("checked", false).attr('disabled', false);
                $('input[name="smstype"]', $con).eq(0).prop("checked", true);
                $('input[name="smstype"]', $con).eq(1).prop("checked", false);
                // $('.assign_file', $con).siblings().remove();
            });
            $('#weituoBox').hide();
            if ($('.connect_work_table').children().length == 0) {
                $('.connect_work').hide();
            }
        });
        // 确认工作交办
        $('#assignmentsure').click(function(){
            var marked;
            if(projectId=='dazu'){
               marked='流水号'
            }else{
               marked='您有新的公文需要办理，流水号'
            }
            var tipMsg =marked+ '：' + runId + '，工作名称/文号：' + globalData.flowRun.runName,
                smsType = '',
                attachmentId = '',
                attachmentName = '',
                assignTask = '',// $('.assign_task').val().trim(),
                jingbanUser = $('#changePerson').attr('user_id') || '';
            
            // if (assignTask == '') {
            //     layer.msg('请填写交办内容！', {icon: 2});
            //     return false;
            // }
            
            if (jingbanUser == '') {
                $.layerMsg({content: '请选择办理人', icon: 2})
                return  false;
            }
            
            var $smsType = $('input[name="smstype"]:checkbox:checked', $('#assignmentContent'));
            $smsType.each(function(){
                smsType += $(this).val() + ',';
            });

            //移动端上传附件 TODO
            // var $assignFiles = $('img[name="assignfile"]', $('#assignmentContent'));
            // $assignFiles.each(function(){
            //     var atturl = $(this).attr('atturl');
            //     var fileDataArr = atturl.split('&');
            //     var fileData = {}
            //     fileDataArr.forEach(function(item){
            //         var key = item.split('=')[0]
            //         var value = item.split('=')[1]
            //         fileData[key] = value
            //     });
            //     attachmentId += fileData['AID'] + '@' + fileData['YM'] + '_' + fileData['ATTACHMENT_ID'] + ',';
            //     attachmentName += fileData['ATTACHMENT_NAME'] + ',';
            // });

            var data = {
                assignTask: assignTask,
                flowId: $.GetRequest().flowId,
                runId: $.GetRequest().runId,
                prcsId: $.GetRequest().flowStep || '',
                thisrunName: $('.num').attr('thisrunName') || '',
                tableName: $.GetRequest().tableName || '',
                jingbanUser: jingbanUser,
                viewUser: $('#viewUserName').attr('user_id') || '',
                prcsflag: 1,
                prcsId: globalData.flowRunPrcs.prcsId,
                currentPrcsId: globalData.flowProcesses.prcsId,
                flowPrcs: globalData.flowPrcs,
                signYn: globalData.feedback,
                prcsName: globalData.flowProcesses.prcsName,
                attachmentId: attachmentId,
                attachmentName: attachmentName,
                smsType: smsType,
                smsContent: tipMsg
            }

            $.post('/flowAssign/saveWork', data, function(res){
                if (res.flag) {
                    // $('#assignmentDetail').show();
                    // $('#assignmentBox').hide().siblings().show(0, function(){
                    //     var $con = $('#assignmentContent');
                    //     $('.assign_task', $con).val('');
                    //     $('#changePerson', $con).val('').attr('user_id', '');
                    //     $('input[name="opinionType"]', $con).eq(0).prop("checked",true);
                    //     $('input[name="opinionType"]', $con).eq(1).prop("checked",false).attr('disabled', false);
                    //     $('input[name="smstype"]', $con).eq(0).prop("checked",true);
                    //     $('input[name="smstype"]', $con).eq(1).prop("checked",false);
                    //     // $('.assign_file', $con).siblings().remove();
                    // });
                    // $('#weituoBox').hide();
                    $.layerMsg({content: '交办成功', icon: 1}, function () {
                        setTimeout(function () {
                            if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {
                                try{
                                    window.webkit.messageHandlers.finishWork.postMessage({});
                                }catch(err){
                                    finishWork();
                                }
                            } else if (/(Android)/i.test(navigator.userAgent)) {
                                Android.finishWebActivity();
                            }
                        }, 100);
                    });
                } else {
                    $.layerMsg({content: '交办失败', icon: 2})
                }
            });
        });
        // 查看交办详情
        $('#assignmentDetail').click(function(){

            var viewUser = $('#viewUserName').attr('user_id') ||'';
            var thisrunName= $('.num').attr('thisrunName')||'';

            var url = '/flowAssign/flowAssignDetail?';
            url += 'runId=' + globalData.runId + '&flowId=' + globalData.flowId + '&tableName=' + globalData.tableName + '&tabId=' + globalData.tabId + '&prcsId=' +globalData.flowRunPrcs.prcsId+ '&currentPrcsId=' +globalData.flowProcesses.prcsId+ '&id=' +globalData.flowRunPrcs.id+ '&runName=' +globalData.flowRun.runName+ '&prcsName=' +globalData.flowProcesses.prcsName+ '&flowPrcs=' +globalData.flowRunPrcs.flowPrcs+ '&feedback=' + globalData.feedback + '&viewUser=' +viewUser + '&thisrunName='+thisrunName;

            if($.getQueryString("type") == 'EWC'){
                window.location.href = encodeURI(url);
            }else{
                if(/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {
                    try{
                        window.webkit.messageHandlers.formInfoUrlLink.postMessage({'url':encodeURI(url) + '&formInfo=formInfo','name':'交办详情'});
                    }catch(err){
                        formInfoUrlLink(encodeURI(url) + '&formInfo=formInfo','交办详情');
                    }
                    // window.location.href = encodeURI(url);
                }else if(/(Android)/i.test(navigator.userAgent)){
                    Android.formInfoUrlLink(encodeURI(url) + '&formInfo=formInfo','交办详情');
                    // window.location.href = encodeURI(url);
                }
            }
        });
        // 查看关联工作流程
        $(document).on('click', '.open_flow_work',function(){
            var flowId = $(this).attr('flowid');
            var runId = $(this).attr('runid');
            if($.getQueryString("type") == 'EWC'){
                window.location.href = '/workflow/work/workformPreView?flowId=' + flowId + '&flowStep=&prcsId=&runId=' + runId + '&formInfo=formInfo';
            }else{
                if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {
                    try{
                        window.webkit.messageHandlers.formInfoUrlLink.postMessage({'url':'/workflow/work/workformh5PreView?flowId=' + flowId + '&flowStep=&prcsId=&runId=' + runId + '&formInfo=formInfo','name':'流程详情'});
                    }catch(error){
                        formInfoUrlLink('/workflow/work/workformh5PreView?flowId=' + flowId + '&flowStep=&prcsId=&runId=' + runId + '&formInfo=formInfo','流程详情');
                    }
                } else if (/(Android)/i.test(navigator.userAgent)) {
                    Android.formInfoUrlLink('/workflow/work/workformh5PreView?flowId=' + flowId + '&flowStep=&prcsId=&runId=' + runId + '&formInfo=formInfo','流程详情');
                }
            }
        });
        // 选择会签意见
        $('.sign_btn').click(function(){
            var signModalIndex = layer.open({
                skin: 'sign_modal',
                title:'选择常用意见',
                area: ['90%', '50%'],
                type: 1,
                content: '<div id="saveRule" >' +
                    '<ul class="sign_list" style="padding: 5px 10px;"></ul>' +
                    '</div>'
                ,
                btn: ['确定'],
                btnAlign: 'c',
                success: function(){
                    $.get('/flowOpinion/selectFlowOpinion',function(res){
                        var data = res.object;
                        if (res.flag) {
                            if (data.length > 0) {
                                var str=''
                                for (var i = 0; i < data.length; i++) {
                                    str += '<li style="padding: 3px 5px 3px 15px; line-height: 20px;"><input style="margin-right: 5px; vertical-align: middle;" type="radio" name="commonObservation" data-id="'+data[i].opinionId+'" value="'+data[i].opinionContent+'" >'+data[i].opinionContent+'</li>';
                                }
                                $('.sign_list').html(str);
                            }
                        }
                    });
                },
                yes: function() {
                    var val = $('input[name="commonObservation"]:checked').val() || '';
                    $('#signText').val(val);
                    layer.close(signModalIndex);
                }
            });
        });
        // 交办选择常用意见
        $('#assignmentSign').on('click', function(){
            var signModalIndex = layer.open({
                skin: 'sign_modal',
                title:'选择常用意见',
                area: ['90%', '50%'],
                type: 1,
                content: '<div id="saveRule" >' +
                    '<ul class="sign_list" style="padding: 5px 10px;"></ul>' +
                    '</div>'
                ,
                btn: ['确定'],
                btnAlign: 'c',
                success: function(){
                    $.get('/flowOpinion/selectFlowOpinion',function(res){
                        var data = res.object;
                        if (res.flag) {
                            if (data.length > 0) {
                                var str=''
                                for (var i = 0; i < data.length; i++) {
                                    str += '<li style="padding: 3px 5px 3px 15px; line-height: 20px;"><input style="margin-right: 5px; vertical-align: middle;" type="radio" name="commonObservation" data-id="'+data[i].opinionId+'" value="'+data[i].opinionContent+'" >'+data[i].opinionContent+'</li>';
                                }
                                $('.sign_list').html(str);
                            }
                        }
                    });
                },
                yes: function() {
                    var oldVal = $('.assign_task').val();
                    var val = oldVal + $('input[name="commonObservation"]:checked').val() || '';
                    $('.assign_task').val(val);
                    layer.close(signModalIndex);
                }
            });
        })
        // EWC文件上传
        $('#uploadinputimg').change(function(e){
            var uploadType = $(this).attr('uploadType') || '';
            if (!uploadType) {
                return false;
            }
            var tableName = $.GetRequest().tableName|| '';
            if(tableName == 'budget'){
                $('#uploadimgform').attr('action','/budget/workUpload?module=workflow&flag=0')
            }

            layer.load();
            $('#uploadimgform').ajaxSubmit({
                type: 'post',
                success: function (res) {
                    res = $.parseJSON(res);
                    if($('#uploadinputimg').val() != ''){
                        if(res.flag){
                            $('#uploadinputimg').val('');
                            var data=res.obj;
                            var imgs = '';
                            var names = '';
                            data.forEach(function (v,i) {
                                var arr = v.attachFile.split('.');
                                var attachName = v.attachName;
                                var fileExtension=attachName.substring(attachName.lastIndexOf(".")+1,attachName.length);//截取附件文件后缀
                                var attName = encodeURI(attachName).replace(/\+/g, "%2b").replace(/\@/g,"%40").replace(/#/g,"%23").replace(/\&/g,"%26").replace(/\//g,"%2F").replace(/\?/g,"%3F").replace(/\￥/g,"%ef%bf%a5").replace(/$/g,"%24").replace(/\！/g,"%ef%bc%81").replace(/\（/g,"%ef%bc%88").replace(/\）/g,"%ef%bc%89").replace(/\…/g,"%e2%80%a6%e2%80%a6");
                                var fileExtensionName=attName.substring(0,attName.lastIndexOf("."));
                                var attachmentUrl = v.attUrl;
                                attachmentUrl = attachmentUrl.substring(0,attachmentUrl.lastIndexOf("ATTACHMENT_NAME="))+"ATTACHMENT_NAME="+fileExtensionName+"."+fileExtension; //处理附件名字
                                imgs += '/xs?' + encodeURI(attachmentUrl) + ',';
                                names += attachName + ',';
                            });
                            layer.closeAll();
                            if (uploadType == 1) {
                                imgadd1(imgs,names,uploadType);
                            } else if (uploadType == 3) {
                                imgupload3(imgs,names,uploadType);
                            } else if (uploadType == 4) {
                                imgupload4(imgs,names,uploadType);
                            }
                        }else {
                            layer.closeAll();
                            $.layerMsg({content:'上传失败！',icon:2},function(){});
                        }
                    }
                }
            });
        });
        //声明下签章、手写控件START
        if($('input[data-type=djsign]').length != 0){
            function DWebSignSealFUN(){
                for(var i=0;i<$('input[data-type=djsign]').length;i++){
                    sign_arr.push($('input[data-type=djsign]').eq(i).attr('name'));
                }
                LoadSignDataH5(sign_arr);
            }
            DWebSignSealFUN()
        }
        //声明下签章、手写控END
//        var vConsole = new VConsole();
        function auto() {
            var width = $('#word').width() / 2;
            $('#word .table td').css('width', '' + width + '');
            var width1 = width - 62;
            $('#word .action').css('width', '' + width1 + '');
        }
        function dateclick(e) {
            laydate({
                elem: '#' + $(e).attr('target'),
                format: 'YYYY-MM-DD hh:mm:ss'
            });
        }

        // 查看新闻内容
        $(document).on('click', '.edit_news_content', function () {
            var newsId = $(this).attr('newsid');
            layer.open({
                type: 1,
                title: '新闻内容',
                area: ['100%', '100%'],
                content: '<div><style>#newsContent p {margin: 8px 0;font-size: 12px;color: #444;line-height: 20px;} #newsContent img { width: 100%;height: 100%;}</style><div id="newsContent" style="width: 100%; height: 100%;"></div></div>',
                success: function () {
                    $.get('/news/getOneById', {newsId: newsId, changId: "1"}, function (res) {
                        if (res.flag) {
                            $('#newsContent').html(res.object.content);
                        }
                    });
                }
            });
        });
        
        // 滑到顶部
        $('#scrollTop').on('click', function(){
            $('html,body').animate({scrollTop: 0},500);
        });
        // 滑到底部
        $('#scrollBottom').on('click', function(){
            var $sign = $('.sign');
            var top = 0;
            if ($sign.length > 0) {
                var index = -1;
                for (var i = $sign.length; i > 0; i--) {
                    if (!$sign.eq(i-1).is(':hidden')) {
                        index = i - 1;
                        break;
                    }
                }
                if (index != -1) {
                    top = $sign.eq(index).offset().top - 100;
                    $sign.eq(index).focus();
                } else {
                    top = $(document).height()-$(window).height();
                }
            } else {
                top = $(document).height()-$(window).height();
            }
            $('html,body').animate({scrollTop: top},500);
        });

    });
    function addsignImg (e) {
        var $area = $(e).prev();
        var signModalIndex = layer.open({
            skin: 'sign_modal',
            title:'选择常用意见',
            area: ['90%', '50%'],
            type: 1,
            content: '<div id="saveRule" >' +
                '<ul class="sign_list" style="padding: 5px 10px;"></ul>' +
                '</div>'
            ,
            btn: ['确定'],
            btnAlign: 'c',
            success: function(){
                $.get('/flowOpinion/selectFlowOpinion',function(res){
                    var data = res.object;
                    if (res.flag) {
                        if (data.length > 0) {
                            var str=''
                            for (var i = 0; i < data.length; i++) {
                                str += '<li style="padding: 3px 5px 3px 15px; line-height: 20px;"><input style="margin-right: 5px; vertical-align: middle;" type="radio" name="commonObservation" data-id="'+data[i].opinionId+'" value="'+data[i].opinionContent+'" >'+data[i].opinionContent+'</li>';
                            }
                            $('.sign_list').html(str);
                        }
                    }
                });
            },
            yes: function() {
                var opinionContent = $('input[name="commonObservation"]:checked').val() || '';

                $area.val(opinionContent);

                var pre = $area.prev();
                // var v = Mustache.render(pre.attr('templ').replace('</div>',''),{content:$(this).val()});
                var templ = pre.attr('templ');
                if (templ.indexOf('eiderarea') == -1) {
                    templ = templ.replace('</div>','');
                    templ = '<div id="eiderarea" class="eiderarea">'+templ+'</div>';
                    pre.attr('templ', templ);
                }
                var v = Mustache.render(templ,{content:opinionContent});
                if(v.indexOf('\n')>-1){
                    // v = v.replace('\n','<br/>');
                    v = v.replace(/\n/g,'<br/>')
                }

                var $div = $('<div>'+v+'</div>');
                var timeStamp = new Date().getTime();
                $div.find('.eiderarea').last().append('<strong class="remove_sign">x</strong>')
                    .attr('user_id', globalData.flowRunPrcs.userId).attr('prcs_id', globalData.flowRunPrcs.prcsId).attr('time_stamp', timeStamp);

                pre.attr('tv',$div.html());
                
                $div.find('.eiderarea').each(function(index){
                    if ($(this).attr('user_id') == globalData.flowRunPrcs.userId && $(this).attr('prcs_id') == globalData.flowRunPrcs.prcsId) {
                        if ($div.find('.eiderarea').length - 1 > index) {
                            $(this).find('.remove_sign').show()
                        }
                    } else {
                        $(this).find('.remove_sign').hide()
                    }
                });
                pre.html($div.html())

                layer.close(signModalIndex);
            }
        });
    }
</script>
</body>
</html>